/*
@Author   : Uyynot
@Email    : uyynot@qq.com
@Time     : 2023/10/18 18:33
@File     : user.go
@Project  : GoProject
@Desc     :
*/
package repository

import (
	"GoProject/internal/model"
	"context"
	"github.com/pkg/errors"
)

type UserRepository interface {
	Create(ctx context.Context, user *model.User) error
}
type userRepository struct {
	*Repository
}

func NewUserRepository(r *Repository) UserRepository {
	return &userRepository{Repository: r}
}

func (r *userRepository) Create(ctx context.Context, user *model.User) error {
	if err := r.db.Create(user).Error; err != nil {
		return errors.Wrap(err, "创建用户失败")
	}
	return nil
}
